This repository was archived by the owner on Sep 27, 2024. It is now read-only.
Add force option to mailbox.put #25
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds an option to force overwrite the message already in
Mailbox
. This is necessary for dart-sass to properly shutdown. As dart-sass is being shutting down, we send a zero length message to the worker isolate to indicate that the main isolate is planning to shutdown, that no further work shall be done. Once the worker isolate received the message and detected that the length is zero, it will break out of the loop and stop the work, in order to prevent it from running anothermailbox.take
and getting stuck.https://github.com/sass/dart-sass/blob/d4b19397c493adb6e518ed5344913aa2615c11f6/lib/src/embedded/reusable_isolate.dart#L119-L129
This currently causes an issue that dart vm would lock up if sending of the empty message fails due to
Mailbox
already has content, and thus causes the worker isolate to not shutting down properly if it gets a non-empty message and quickly loop again to wait on the next message before the kill event is processed: sass/dart-sass#2278I've tested locally that this PR together with the following patch in dart-sass fixes the issue: sass/dart-sass#2279